/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gui;

import javax.microedition.lcdui.*;

/**
 * @author REX
 */
public class Ayuda extends Canvas implements CommandListener {
    private int width,height;
    private int anchor = Graphics.TOP | Graphics.LEFT;
    private int barTitulo = 20;
    MenuPrincipal mp;
    public Ayuda(MenuPrincipal mp) {
        try {
            this.mp = mp;
	    // Set up this canvas to listen to command events
	    setCommandListener(this);
	    // Add the Exit command
	    addCommand(new Command("Regresar", Command.BACK, 1));
        } catch(Exception e) {
            e.printStackTrace();
        }
    } 
    
    public void limpiaPantalla(Graphics g){
        g.setColor( 255, 255, 255 );
        g.fillRect( 0, 0, width, height );
    }
    public void paint(Graphics g) {
        width = getWidth();
        height = getHeight();
        limpiaPantalla(g);
        Font f = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE);
        g.setFont(f);
        g.setColor(0x32639A);
        /*Titulo*/
        String titulo = "Ayuda";
        int anchoTitulo = f.stringWidth(titulo);
        int altoTitulo = f.getHeight();
        int posXt = (width - anchoTitulo)/2;
        int posYt = barTitulo- altoTitulo;
        g.drawString(titulo,posXt ,posYt , anchor);
        g.setColor(0x4486C7);
        g.setStrokeStyle(Graphics.SOLID);
        g.drawLine(0, barTitulo - 1, width, barTitulo - 1);
        g.drawLine(0, barTitulo, width, barTitulo);

        Font f2 = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
        g.setFont(f2);
        int padding = 5;
        int deltax = padding;
        g.setColor(0xFFFFFF);
        g.fillRect( deltax,barTitulo + padding , (int)(width*0.5),(int)(height*0.5) );
        g.setColor(0x5D781D);
        g.drawString(" Aqui va un texto",deltax + padding, barTitulo + padding + f2.getHeight()*1, anchor);
        g.drawString(" Aqui va otro texto",deltax + padding, barTitulo + padding + f2.getHeight()* 2, anchor);
        g.drawString(" Aqui va otro texto",deltax + padding, barTitulo + padding + f2.getHeight()* 3, anchor);
        g.drawString(" Aqui va otro texto",deltax + padding, barTitulo + padding + f2.getHeight()* 4, anchor);
        g.drawString(" Aqui va otro texto",deltax + padding, barTitulo + padding + f2.getHeight()* 5, anchor);
        g.setColor(0x89B056);
        g.drawRect(  deltax,barTitulo + padding , width - 2*padding, height - 2*padding - 26);
    }
    
    public void commandAction(Command command, Displayable displayable) {
        if(command.getLabel().equals("Regresar")){
            mp.getMidlet().pantalla.setCurrent(mp);
        }
    }

}